import random
import time
from multiprocessing import Process, Value, Array
import os


def man(money):
    for i in range(30):
        time.sleep(0.2)
        money.value += random.randint(1, 1000)


def girl(money):
    for i in range(30):
        time.sleep(0.15)
        money.value -= random.randint(100, 800)


if __name__ == "__main__":
    money = Value('i', 5000)
    m = Process(target=man, args=(money,))
    g = Process(target=girl, args=(money,))
    m.start()
    g.start()
    m.join()
    g.join()
    print('一月余额：', money.value)
